package com.myth.other;

import org.junit.Test;

import java.math.BigDecimal;
import java.math.BigInteger;

/**
 * 其他常用类的使用
 * 1. System
 * 2. Math
 * 3. BigInteger 和 BigDecimal
 *
 */
public class OtherClassTest {
    public static void main(String[] args) {
        String javaVersion = System. getProperty("java.version");
        System. out. println("java的version:" + javaVersion);

        String javaHome = System. getProperty("java.home");
        System. out . println("java的home:" + javaHome);

        String osName = System. getProperty("os.name");
        System. out . println("os的name:" + osName);

        String osVersion = System. getProperty("os.version" );
        System. out. println("os的version:" + osVersion);

        String userName = System. getProperty("user.name");
        System. out. println("user的name:" + userName);

        String userHome = System. getProperty("user.home");
        System. out. println("user的home:" + userHome);

        String userDir = System.getProperty("user.dir");
        System. out. println("user的dir:" + userDir);
    }

    /**
     *
     * java.lang.Math提供了- -系列静态方法用于科学计算。其方法的参数和返回值类型一殷为double 型。
     *
     * 1.abs:绝对值
     * 2.acos,asin,atan,cos,sin,tan三角函数
     * 3.sqrt平方根
     * 4.pow(double a,doble b) a的b次幂
     * 5.iog自 然对数
     * 6.exp  e为底指数
     * 7.max(double a,double b)
     * 8.min(double a,double b)
     * 9.random()返 回0.0到1.0的随机数
     * 10.long round(double a) double 型数据a转换为long型(四舍五入)
     * 11.toDegrees(double angrad)  弧度一-> 角度
     * 12.toRadians(double angdeg)  角度- ->弧度
     *
     */

    /**
     *
     *
     *
     */
    @Test
    public void test2(){
        BigInteger bi = new BigInteger("34567897654356789876545678876546789");
        BigDecimal bd = new BigDecimal("465787654678.54324");
        BigDecimal bd2 = new BigDecimal("11");
        System.out.println(bi);
        System.out.println(bd.divide(bd2,BigDecimal.ROUND_HALF_UP));
        System.out.println(bd.divide(bd2,0,BigDecimal.ROUND_HALF_UP));

    }


}
